package br.com.infocruz.seam.crm.ejb.jpa;

import javax.persistence.Query;

import org.jboss.seam.framework.EntityQuery;

import br.com.infocruz.seam.crm.ejb.model.AbstractEntity;

public class JpaQueryBuilder<T extends AbstractEntity> extends EntityQuery<T> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -1764982190357404341L;

	public JpaQueryBuilder(Class<T> entityClass) {
		this(JpaQueryHelper.getDefaultEjbql(entityClass));
	}
	
	public JpaQueryBuilder(String ejbql) {
		setEjbql(ejbql);
		parseEjbql();
	}
	
	@Override
	public String getCountEjbql() {
		return super.getCountEjbql();
	}	
	
	@Override
	public Query createQuery() {
		return super.createQuery();
	}
	
	@Override
	public Query createCountQuery() {
		return super.createCountQuery();
	}
	
	public String getParsedEjbql(){
		return getRenderedEjbql();
	}
	
}
